#ifndef JOINTS_H
#define JOINTS_H

#include "vector3D.h"
#include "coordinate3D.h"

enum jointsEnum { JOINT, REVOLUTE, PRISMATIC, GRIPPER, WELDER };

class Joint	//base class for all joints
{
public:
	Joint(int type);
	Joint(int type, float transK, float rotK, float transI, float rotI);
	
	//set by core calculations
	void setCenter(coord3D position); 
        void setStaticCenter(coord3D position);
	void setOrientationK(vector3D orientation);
        void setStaticOrientationK(vector3D orientation);
	
        //these four are for drawing
        bool axesDrawn();
        coord3D getCenter();
        coord3D getStaticCenter();
	vector3D orientationK();
        vector3D staticOrientationK();
	vector3D orientationI();	//this is needed because rotations start from the I axis
	
	//dh paramter accessor functions (for calculating -- everything should be calculated soley from these values)
	float dhTranslationK();
	float dhRotationK();
	float dhTranslationI();
	float dhRotationI();
	
	void setTranslationK(float distance);
	void setRotationK(float angle);
	void setTranslationI(float distance);
	void setRotationI(float angle);
	
	void actuate(float actuateLevel);
        void setDrawAxes(bool draw);
	int getType();
	
	bool rotate(float angle);
	bool extend(float distance);
	bool gripClench();
	bool gripRelease();
// 	bool welderOn();
// 	bool welderOff();
	
	float getRotation(bool *ok);
	float getExtension(bool *ok);
	bool getGripperStatus(bool *ok);

	float getMinimum();
	float getMaximum();
	float getCurrentActuation();
	
	bool setRotationLimits(float min, float max);
	bool setExtensionLimits(float min, float max);
	
	

private:
	int jointType;
	
	coord3D centerPosition;
        coord3D staticCenter;
	vector3D orientationOfI;
	vector3D orientationOfJ;
	vector3D orientationOfK;
        vector3D staticOrientationOFK;
	
	//DH parameters 
	float translationAlongK;
	float rotationAroundK;
	float translationAlongI;
	float rotationAroundI;
	
	float currentRotationAngle;
	float leftStopAngle;
	float rightStopAngle;
	
	float currentExtension;
	float minExtension;
	float maxExtension;
	
	bool clenched;
	bool welding;
        bool drawAxes;
};

#endif
